package com.czp.mall.service;

import java.util.HashMap;
import java.util.Map;

import org.springframework.stereotype.Service;

import com.czp.mall.pojo.Item;


@Service
public class ItemService {

	private static final Map<Long, Item> MAP = new HashMap<Long, Item>();
	
	static {
		MAP.put(1l, new Item(1l, "title1", "http://image1", "描述1", 1000l));
		MAP.put(2l, new Item(2l, "title2", "http://image1", "描述2", 1000l));
		MAP.put(3l, new Item(3l, "title3", "http://image1", "描述3", 1000l));
		MAP.put(4l, new Item(4l, "title4", "http://image1", "描述4", 1000l));
		MAP.put(5l, new Item(5l, "title5", "http://image1", "描述5", 1000l));
		MAP.put(6l, new Item(6l, "title6", "http://image1", "描述6", 1000l));
		MAP.put(7l, new Item(7l, "title7", "http://image1", "描述7", 1000l));
	}
	
	/**
	 * 根据id查询商品
	 * @param id
	 * @return
	 */
	public Item findItemById(Long id) {
		return MAP.get(id);
	}
	
}
